package com.hn.gege.core.validdator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.text.ParseException;
import java.text.SimpleDateFormat;


/**
 * 自定义时间(yyyy-MM-dd HH:mm:ss)校验注解实现
 * @author dnkj011
 *
 */
public class IsTimeDetilValidator implements ConstraintValidator<IsTimeDetil,String> {

	@Override
	public boolean isValid(String arg0, ConstraintValidatorContext arg1) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			sdf.parse(arg0);
		} catch (ParseException e) {
			return false;
		}
		return true;
	}

}
